package middleware

import (
	"gitee.com/chejiangyi/bsfgo/core/base2"
	"gitee.com/chejiangyi/bsfgo/core/utils"
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
)

type CorsMiddleware struct{}

func (*CorsMiddleware) GetOrder() float64 {
	return -95
}
func (m *CorsMiddleware) Enabled() bool {
	return base2.BsfConfigInstance.GetCorsEnabled()
}
func (*CorsMiddleware) Middleware(r *gin.Engine) {
	r.Use(cors.Default())
	utils.LogUtil.Info("CorsMiddleware已开启,支持跨域!")
}
